package com.quick.service.impl;

import com.quick.domain.Book;
import com.quick.repository.BookRepository;
import com.quick.service.BookService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

/**
 * Created by jing on 2017/12/6.
 */
@Service("bookService")
public class BookServiceImpl implements BookService{
    @Resource
    private BookRepository bookRepository;
    @Transactional
    @Override
    public void save(){
        try {
            Book book = new Book();
            book.setName("book");
            book.setAuthor("wang");
            book.setIsbn("666");
            bookRepository.save(book);
            int a = 1/0;
        }catch (Exception e){
            throw new RuntimeException("error");
        }

    }
}
